package main

import "fmt"

func main() {
	var numbers = make([]int, 3, 5)

	fmt.Printf("len = %d, cap = %d, 8-slice = %v\n", len(numbers), cap(numbers), numbers)

	// 向numbers切片追加一个元素1，numbers len = 4, [0 0 0 1], cap = 5
	numbers = append(numbers, 1)
	fmt.Printf("len = %d, cap = %d, 8-slice = %v\n", len(numbers), cap(numbers), numbers)

	// 向numbers切片追加一个元素1，numbers len = 6, [0 0 0 1 2 3], cap = 10
	// 如果向一个容量cap已满的slice 追加元素
	numbers = append(numbers, 2, 3)
	fmt.Printf("len = %d, cap = %d, 8-slice = %v\n", len(numbers), cap(numbers), numbers)
}
